# class 26
str = """admin
folder_list	0
folder_name	根节点
id
is_del	0
name	大&
opmode	add
pid	0
read
remark
sort
write	"""
dict = {}
temp = str.split('\n')
for i in temp:
    if len(i.split('\t')) == 2:
        dict[i.split('\t')[0]] = i.split('\t')[1]
    else:
        dict[i.split('\t')[0]] = ''
print(dict)


# class 27
def change_string(string):
    str1 = string.split('&')
    dic = {}
    for i in str1:
        a = i.index('=')
        c = i[0:a]
        d = i[a + 1:len(i)]
        c = ''.join(c)
        d = ''.join(d)
        dic.update({c: d})
    return dic


string = 'id=&opmode=add&admin=&write=&read=&folder_list=0&name=%E6%9D%8E%E7%8B%97%E5%97%A8&folder_name=%E6%A0%B9%E8%8A%82%E7%82%B9&pid=0&sort=&is_del=0&remark='
print(change_string(string))

# class 29
import urllib
from urllib import parse

# a = 'id=&opmode=add&admin=&write=&read=&folder_list=0&name=%E6%9D%8E%E7%8B%97%E5%97%A8&folder_name=%E6%A0%B9%E8%8A%82%E7%82%B9&pid=0&sort=&is_del=0&remark='
a = 'from=&name=eiyo1314&pwd=lian040827&cpwd=lian040827&verifyCode=fdwtxx&phone=18113028757&phone_v_code=199532&gender=a.txt&agree_terms=a.txt'
a = urllib.parse.unquote(a)
split = a.split('&')
data = {}
for i in split:
    sp = i.split('=')
    data.update({sp[0]: sp[1]})
print(data)
